<?php
class Site_Form_UploadOdt extends Promotor_Form_Scaffold {
	public function init() {
		$this->setMethod('post');
		$this->setAttrib('enctype', Zend_Form::ENCTYPE_MULTIPART);

		$this->addPrefixPath('Promotor_Form_Decorator_','Promotor/Form/Decorator', self::DECORATOR);

        $subForm = $this->_getFileForm();
        $this->addSubForm($subForm, 'filetab');
	}

	/**
     * @return Zend_Dojo_Form_SubForm
     */
	protected function _getFileForm() {
    	$subForm = new Zend_Form_SubForm();
        $subForm->setAttribs(array(
            'name'   => 'filetab',
            'legend' => 'Dokument tekstowy',
        ));
        $subForm
        	->addElement(new KontorX_Form_Element_File('file', array(
        		'label' => 'Dokument tekstowy, OpenOffice.org',
        		'required' => true,
        		'validators' => array(
        			'upload' => array(
        				'validator' => 'Upload'),
        			'extension' => array(
        				'validator' => 'Extension',
        				'options' => array('odt')),
        			'count' => array(
        				'validator' => 'Count',
        				'options' => array(
        					'max' => 1))
        		)
        	)));

        return $subForm;
    }
}